home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / reiser4 / tree.h < prev    next >
C/C++ Source or Header  |  2006-01-09  |  6KB  |  192 lines

  1. /* Copyright (C) 2001, 2002, 2003, 2004 by Hans Reiser, licensing governed by
  2.    reiser4progs/COPYING.
  3.    
  4.    tree.h -- reiser4 balanced tree functions. */
  5.  
  6. #ifndef REISER4_TREE_H
  7. #define REISER4_TREE_H
  8.  
  9. #include <reiser4/types.h>
  10.  
  11. #define REISER4_TREE_MAX_HEIGHT 10
  12.  
  13. extern void reiser4_tree_close(reiser4_tree_t *tree);
  14. extern errno_t reiser4_tree_adjust(reiser4_tree_t *tree);
  15. extern errno_t reiser4_tree_collapse(reiser4_tree_t *tree);
  16. extern reiser4_tree_t *reiser4_tree_init(reiser4_fs_t *fs);
  17.  
  18. extern errno_t reiser4_tree_root_key(reiser4_tree_t *tree,
  19.                      reiser4_key_t *key);
  20.  
  21. extern errno_t reiser4_tree_walk_node(reiser4_tree_t *tree,
  22.                       reiser4_node_t *node,
  23. #ifndef ENABLE_MINIMAL
  24.                       walk_func_t pre_func,
  25.                       walk_on_func_t on_func,
  26. #endif
  27.                       walk_func_t post_func);
  28.  
  29. extern errno_t reiser4_tree_next_place(reiser4_tree_t *tree, 
  30.                        reiser4_place_t *place,
  31.                        reiser4_place_t *next);
  32.  
  33. extern errno_t reiser4_tree_place_key(reiser4_tree_t *tree, 
  34.                       reiser4_place_t *place,
  35.                       reiser4_key_t *key);
  36.  
  37. extern errno_t reiser4_tree_connect_node(reiser4_tree_t *tree,
  38.                      reiser4_node_t *parent,
  39.                      reiser4_node_t *node);
  40.  
  41. extern errno_t reiser4_tree_disconnect_node(reiser4_tree_t *tree,
  42.                         reiser4_node_t *node);
  43.  
  44. extern reiser4_node_t *reiser4_tree_child_node(reiser4_tree_t *tree,
  45.                            reiser4_place_t *place);
  46.  
  47. #ifndef ENABLE_MINIMAL
  48. extern errno_t reiser4_tree_discard_node(reiser4_tree_t *tree,
  49.                      reiser4_node_t *node);
  50.  
  51. extern inline uint32_t reiser4_tree_target_level(reiser4_tree_t *tree,
  52.                          reiser4_plug_t *plug);
  53.  
  54. extern bool_t reiser4_tree_fresh(reiser4_tree_t *tree);
  55. extern bool_t reiser4_tree_minimal(reiser4_tree_t *tree);
  56. extern bool_t reiser4_tree_singular(reiser4_tree_t *tree);
  57. extern errno_t reiser4_tree_sync(reiser4_tree_t *tree);
  58. extern errno_t reiser4_tree_growup(reiser4_tree_t *tree);
  59. extern errno_t reiser4_tree_dryout(reiser4_tree_t *tree);
  60. extern errno_t reiser4_tree_compress(reiser4_tree_t *tree);
  61.  
  62. extern void reiser4_tree_set_root(reiser4_tree_t *tree, blk_t blk);
  63. extern void reiser4_tree_set_height(reiser4_tree_t *tree, uint8_t height);
  64.  
  65. extern int64_t reiser4_tree_insert(reiser4_tree_t *tree,
  66.                    reiser4_place_t *place,
  67.                    trans_hint_t *hint,
  68.                    uint8_t level);
  69.  
  70. extern int64_t reiser4_tree_write(reiser4_tree_t *tree,
  71.                   reiser4_place_t *place,
  72.                   trans_hint_t *hint,
  73.                   uint8_t level);
  74.  
  75. extern errno_t reiser4_tree_remove(reiser4_tree_t *tree,
  76.                    reiser4_place_t *place,
  77.                    trans_hint_t *hint);
  78.  
  79. extern errno_t reiser4_tree_shift(reiser4_tree_t *tree,
  80.                   reiser4_place_t *place,
  81.                   reiser4_node_t *neig,
  82.                   uint32_t flags);
  83.  
  84. extern errno_t reiser4_tree_shrink(reiser4_tree_t *tree,
  85.                    reiser4_place_t *place);
  86.  
  87. extern int32_t reiser4_tree_expand(reiser4_tree_t *tree,
  88.                    reiser4_place_t *place,
  89.                    reiser4_place_t *parent,
  90.                    uint32_t ilen,
  91.                    uint32_t ioverh,
  92.                    uint32_t flags);
  93.  
  94. extern errno_t reiser4_tree_trav(reiser4_tree_t *tree,
  95.                  tree_open_func_t open_func,
  96.                  node_func_t before_func,
  97.                  place_func_t update_func,
  98.                  node_func_t after_func,
  99.                  void *data);
  100.  
  101. extern errno_t reiser4_tree_update_keys(reiser4_tree_t *tree,
  102.                     reiser4_place_t *place,
  103.                     reiser4_key_t *key);
  104.  
  105. extern errno_t reiser4_tree_assign_root(reiser4_tree_t *tree,
  106.                     reiser4_node_t *node);
  107.  
  108. extern errno_t reiser4_tree_load_root(reiser4_tree_t *tree);
  109.  
  110. extern reiser4_node_t *reiser4_tree_alloc_node(reiser4_tree_t *tree,
  111.                            uint8_t level);
  112.  
  113. extern errno_t reiser4_tree_unlock_node(reiser4_tree_t *tree,
  114.                     reiser4_node_t *node);
  115.  
  116. extern bool_t reiser4_tree_attached_node(reiser4_tree_t *tree,
  117.                      reiser4_node_t *node);
  118.  
  119. extern errno_t reiser4_tree_attach_node(reiser4_tree_t *tree,
  120.                     reiser4_node_t *node,
  121.                     reiser4_place_t *place,
  122.                     uint32_t flags);
  123.  
  124. extern errno_t reiser4_tree_detach_node(reiser4_tree_t *tree,
  125.                     reiser4_node_t *node,
  126.                     uint32_t flags);
  127.  
  128. extern errno_t reiser4_tree_trav_node(reiser4_tree_t *tree,
  129.                       reiser4_node_t *node,
  130.                       tree_open_func_t open_func,
  131.                       node_func_t before_func,
  132.                       place_func_t update_func,
  133.                       node_func_t after_func,
  134.                       void *data);
  135.  
  136. extern int64_t reiser4_tree_modify(reiser4_tree_t *tree, reiser4_place_t *place,
  137.                    trans_hint_t *hint, uint8_t level, 
  138.                    estimate_func_t estimate_func,
  139.                    modify_func_t modify_func);
  140.  
  141. extern errno_t reiser4_tree_copy(reiser4_tree_t *src_tree,
  142.                  reiser4_tree_t *dst_tree);
  143.  
  144. extern errno_t reiser4_tree_resize(reiser4_tree_t *tree,
  145.                    count_t blocks);
  146.  
  147. extern uint8_t reiser4_tree_get_height(reiser4_tree_t *tree);
  148.  
  149. extern errno_t reiser4_tree_rehash_node(reiser4_tree_t *tree,
  150.                     reiser4_node_t *node,
  151.                     blk_t new_blk);
  152.  
  153.  
  154. #endif
  155.  
  156. extern blk_t reiser4_tree_get_root(reiser4_tree_t *tree);
  157. extern uint32_t reiser4_tree_get_blksize(reiser4_tree_t *tree);
  158.  
  159. extern errno_t reiser4_tree_unload_node(reiser4_tree_t *tree,
  160.                     reiser4_node_t *node);
  161.  
  162. extern errno_t reiser4_tree_release_node(reiser4_tree_t *tree,
  163.                      reiser4_node_t *node);
  164.  
  165. extern lookup_t reiser4_tree_collision(reiser4_tree_t *tree,
  166.                        reiser4_place_t *place,
  167.                        coll_hint_t *hint);
  168.  
  169. extern lookup_t reiser4_collision_handler(reiser4_place_t *place,
  170.                       lookup_bias_t bias,
  171.                       lookup_t lookup,
  172.                       void *data);
  173.  
  174. extern reiser4_node_t *reiser4_tree_lookup_node(reiser4_tree_t *tree,
  175.                         blk_t blk);
  176.  
  177. extern reiser4_node_t *reiser4_tree_load_node(reiser4_tree_t *tree,
  178.                           reiser4_node_t *parent,
  179.                           blk_t blk);
  180.  
  181. extern lookup_t reiser4_tree_lookup(reiser4_tree_t *tree, lookup_hint_t *hint,
  182.                     lookup_bias_t bias, reiser4_place_t *place);
  183.  
  184. extern errno_t reiser4_tree_scan(reiser4_tree_t *tree, 
  185.                  node_func_t pre_func, 
  186.                  place_func_t func, 
  187.                  void *data);
  188.  
  189.  
  190. #endif
  191.  
  192.